package iceberg.constraints;

import iceberg.violations.BackCallViolationType;
import iceberg.violations.SkipCallViolationType;
import iceberg.violations.ViolationType;

public class BackOrSkipCallConstraintResult implements IConstraintResult {

	private final boolean isAllowed;
	private final ViolationType type;

	public BackOrSkipCallConstraintResult(boolean allowed, int layerNumber, int otherLayerNumber) {
		isAllowed = allowed;
		if (layerNumber > otherLayerNumber) {
			type = new BackCallViolationType();
		} else {
			type = new SkipCallViolationType();
		}
	}

	@Override
	public boolean isAllowed() {
		return isAllowed;
	}

	@Override
	public ViolationType getType() {
		return type;
	}

	@Override
	public String getName() {
		return "Back-call / Skip-call";
	}


}
